package org.openscheduler.modules.trigger.support;

import static org.quartz.CronScheduleBuilder.cronSchedule;
import static org.quartz.TriggerBuilder.newTrigger;

import java.util.Date;
import java.util.List;

import org.quartz.Trigger;
import org.quartz.TriggerUtils;
import org.quartz.spi.OperableTrigger;

public class ComputeFireTimeUtils {
	
	public static List<Date> computeFireTimes(Trigger trigger, int numTimes) {
		return TriggerUtils.computeFireTimes((OperableTrigger) trigger, null, numTimes);
	}
	
	public static List<Date> computeFireTimes(String cronExpression, int numTimes) {
		Trigger trigger = newTrigger().withSchedule(cronSchedule(cronExpression)).startNow().build();
		return TriggerUtils.computeFireTimes((OperableTrigger) trigger, null, numTimes);
	}
	
}
